<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // RegExp 用于创建正则表达式对象，该对象用于将文本与一个模式匹配
        const regex1 = /\w+/;
        const regex2 = new RegExp('\\w+');
        console.log(regex1);
        // Expected output: /\w+/
        console.log(regex2);
        // Expected output: /\w+/
        console.log(regex1 === regex2);
        // Expected output: false

        const str="我们在学习前端"
        const regex3=new RegExp('java')
        if (regex3.test(str)) {
            console.log(true);
            
        } else {
            console.log(false);
            
        }
    </script>
</body>

</html>